package com.weblog.weblogapi.controller;

import com.weblog.weblogapi.dao.pojo.Comment;
import com.weblog.weblogapi.service.CommentService;
import com.weblog.weblogapi.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comment")
public class CommentController {
    @Autowired
    private CommentService commentService;
    //查询文章评论
    @GetMapping("{id}")
    private Result findCommentByArticleId(@PathVariable("id") int id){return commentService.findCommentByArticleId(id);}
    //写评论
    @PostMapping("/write")
    private Result writeComment(@RequestBody Comment comment){return commentService.writeComment(comment);}
    //删除评论
    @PostMapping("delete/{id}")
    private Result deleteComment(@PathVariable("id") int id){return commentService.deleteComment(id);}
}
